#ifndef MYXPM_H_INCLUDED
#define MYXPM_H_INCLUDED

#include "transf2d.h"

typedef unsigned char uint8;
typedef unsigned int uint32;

struct _Color;
struct _XPM;
struct _Window;

typedef struct _Color Color;
typedef struct _XPM XPM;
typedef struct _Window Window;

Window *setWindow(uint32 wl, uint32 wt, uint32 wr, uint32 wb);
void clearWindow(Window *win);

XPM *initXPM(uint32 width, uint32 height, uint8 cpp, uint32 ncolors);
void freeXPM(XPM *imag);
int putXPMpixel(XPM *imag, uint32 x, uint32 y, uint32 colorindex);
int setXPMcolor(XPM *imag, uint32 index, uint8 r, uint8 g, uint8 b, char *charpattern);
int writeXPMtofile(XPM *imag, char *filepath);
XPM *cloneXPM(XPM *imag, uint8 copyData);
XPM *transfXPM(XPM *imag, Mat3x3 *m);

//Bresenham method
int line(XPM *imag, uint32 x0, uint32 y0, uint32 x1, uint32 y1,
         uint32 colorindex);

//Postscript file to XPM
int ps_to_xpm(char *inputFileName, char *outputFileName, uint32 width, uint32 height,
              Window *win, Mat3x3 *m);

//Cohen-Sutherland
int ClipLine(uint32 x1, uint32 y1, uint32 x2, uint32 y2,
             uint32 *xx1, uint32 *yy1, uint32 *xx2, uint32 *yy2,
             Window win);

#endif // MYXPM_H_INCLUDED
